package com.huanxing.cloud.miniapp.api.feign;

import com.huanxing.cloud.common.core.constant.CacheConstants;
import com.huanxing.cloud.common.core.constant.SecurityConstants;
import com.huanxing.cloud.common.core.constant.ServiceNameConstants;
import com.huanxing.cloud.common.core.util.Result;
import com.huanxing.cloud.miniapp.api.entity.WxApp;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestHeader;

@FeignClient(contextId = "remoteWxAppService", value = ServiceNameConstants.MINIAPP_WEIXIN_SERVICE)
public interface RemoteWxAppService {

	@GetMapping("/app/wxapp/inner/{appId}")
	@Cacheable(value = CacheConstants.WX_APP_CACHE, key = "#appId", unless = "#result.data==null")
	Result<WxApp> getById(@PathVariable("appId") String appId, @RequestHeader(SecurityConstants.SOURCE) String source);

}
